1. Module (chicken process-context posix)
    1. Process filesystem context
      1. change-directory*
      2. set-root-directory!
    2. Retrieving user & group information
      1. current-user-id
      2. current-user-name
      3. current-effective-user-id
      4. current-effective-user-name
      5. current-group-id
      6. current-effective-group-id
    3. Process identity
      1. current-process-id
      2. parent-process-id
      3. process-group-id
      4. create-session
      5. user-information

Module (chicken process-context posix)

This module provides access to POSIX-specific procedures which deal with the current process context.

Process filesystem context

change-directory*

[procedure] (change-directory* FD)
[procedure] (set! (current-directory) FD)

Changes the current working directory to the one represented by the file-descriptor FD, which should be an exact integer.

NOTE: Windows does not allow {open} on directories, so while technically it is supported, in practice you cannot use this procedure on native Windows builds (on cygwin it works because cygwin emulates this).

set-root-directory!

[procedure] (set-root-directory! STRING)

Sets the root directory for the current process to the path given in STRING (using the chroot function). If the current process has no root permissions, the operation will fail.

NOTE: On native Windows builds (all except cygwin), this procedure is unimplemented and will raise an error.

Retrieving user & group information

current-user-id

[procedure] (current-user-id)
[setter] (set! (current-user-id) UID)

Get or set the real user-id of the current process. The procedure corresponds to the getuid and setuid C functions.

NOTE: On native Windows builds (all except cygwin), this procedure is unimplemented and will raise an error.

current-user-name

[procedure] (current-user-name)

Get the login name corresponding to the real user-id of the current process from the system password database.

On Windows, there's no user-id and no distinction between real and effective user, but this procedure will return the username associated with the current process, so it is safe to use.

current-effective-user-id

[procedure] (current-effective-user-id)
[setter] (set! (current-effective-user-id) UID)

Get or set the effective user-id of the current process.

NOTE: On native Windows builds (all except cygwin), this procedure is unimplemented and will raise an error.

current-effective-user-name

[procedure] (current-effective-user-name)

Get the login name corresponding to the effective user-id of the current process from the system password database.

NOTE: On native Windows builds (all except cygwin), this procedure is unimplemented and will raise an error.

current-group-id

[procedure] (current-group-id)
[setter] (set! (current-group-id) GID)

Get or set the real group-id of the current process.

NOTE: On native Windows builds (all except cygwin), this procedure is unimplemented and will raise an error.

current-effective-group-id

[procedure] (current-effective-group-id)
[setter] (set! (current-effective-group-id) GID)

Get or set the effective group-id of the current process. ID can be found, then #f is returned.

NOTE: On native Windows builds (all except cygwin), this procedure is unimplemented and will raise an error.

Process identity

current-process-id

[procedure] (current-process-id)

Returns the process ID of the current process.

parent-process-id

[procedure] (parent-process-id)

Returns the process ID of the parent of the current process.

NOTE: On native Windows builds (all except cygwin), this procedure is unimplemented and will raise an error.

process-group-id

[procedure] (process-group-id PID)
[setter] (set! (process-group-id PID) PGID)

Get or set the process group ID of the process specified by PID.

NOTE: On native Windows builds (all except cygwin), this procedure is unimplemented and will raise an error.

create-session

[procedure] (create-session)

Creates a new session with the current process as group leader. Returns current process id on success. Equivalent to setsid(2).

user-information

[procedure] (user-information USER [AS-VECTOR])

If USER specifes a valid username (as a string) or user ID, then the user database is consulted and a list of 7 values are returned: the user-name, the encrypted password, the user ID, the group ID, a user-specific string, the home directory and the default shell. When AS-VECTOR is #t a vector of 7 elements is returned instead of a list. If no user with this name or id then #f is returned.

Note: on Android systems, the user-specific string is always "", since pw_gecos is not available in the C passwd struct on that platform.

NOTE: On native Windows builds (all except cygwin), this procedure is unimplemented and will raise an error.


Previous: Module (chicken process-context)

Next: Module (chicken random)